using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.BizTalk.SSOClient.Interop;

namespace SSOConfig
{
    class SSOPropertyBag : IPropertyBag
    {
        private Dictionary<string, object> _propertyBag;
        private Dictionary<string, object> PropertyBag
        {
            get
            {
                if (this._propertyBag == null)
                {
                    this._propertyBag = new Dictionary<string, object>();
                }
                return this._propertyBag;
            }
        }

        public SSOPropertyBag() { }


        public void Write(string propName, ref object ptrVar)
        {
            this.PropertyBag.Add(propName, ptrVar);
        }

        public void Read(string propName, out object ptrVar, int errorLog)
        {
            ptrVar = null;
            ptrVar = this.PropertyBag[propName];
        }


        public object GetValue(string key)
        {
            return this.PropertyBag[key];
        }

        public void Setvalue(string key, object value)
        {
            this.PropertyBag[key] = value;
        }

        public List<string> Keys
        {
            get 
            {
                List<string> keys = new List<string>(this.PropertyBag.Count);
                foreach (string key in this.PropertyBag.Keys)
                {
                    keys.Add(key);
                }
                return keys;
            }
        }
    }
}
